<script setup lang="ts">
import { getChannelsAPI } from '@/api/Channels'
import type { ChannelsItem } from '@/types/Channels'
import { onMounted, ref } from 'vue'
const channeloptions = ref<ChannelsItem[]>([])
onMounted(async () => {
  const res = await getChannelsAPI()
  channeloptions.value = res.data.channels
})

const emit = defineEmits(['update:change'])

const changeFn = () => {
  emit('update:change', channeloptions.value)
}
</script>

<template>
  <el-select placeholder="请选择" clearable @change="changeFn">
    <el-option v-for="item in channeloptions" :key="item.id" :label="item.name" :value="item.id" />
  </el-select>
</template>
